#include "builders/baseBuilders_test.hpp"

#include "builders/opfilter/opBuilderHelperFilter.hpp"

namespace filterbuildtest
{
INSTANTIATE_TEST_SUITE_P(
    Builders,
    FilterBuilderTest,
    testing::Values(
        /*** Number ***/
        FilterT({}, opfilter::opBuilderHelperIsNumber, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsNumber, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsNumber, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsNumber, FAILURE()),
        FilterT({}, opfilter::opBuilderHelperIsNotNumber, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsNotNumber, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsNotNumber, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsNotNumber, FAILURE()),
        /*** String ***/
        FilterT({}, opfilter::opBuilderHelperIsString, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsString, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsString, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsString, FAILURE()),
        FilterT({}, opfilter::opBuilderHelperIsNotString, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsNotString, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsNotString, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsNotString, FAILURE()),
        /*** Boolean ***/
        FilterT({}, opfilter::opBuilderHelperIsBool, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsBool, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsBool, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsBool, FAILURE()),
        FilterT({}, opfilter::opBuilderHelperIsNotBool, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsNotBool, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsNotBool, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsNotBool, FAILURE()),
        /*** Array ***/
        FilterT({}, opfilter::opBuilderHelperIsArray, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsArray, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsArray, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsArray, FAILURE()),
        FilterT({}, opfilter::opBuilderHelperIsNotArray, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsNotArray, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsNotArray, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsNotArray, FAILURE()),
        /*** Object ***/
        FilterT({}, opfilter::opBuilderHelperIsObject, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsObject, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsObject, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsObject, FAILURE()),
        FilterT({}, opfilter::opBuilderHelperIsNotObject, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsNotObject, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsNotObject, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsNotObject, FAILURE()),
        /*** Null ***/
        FilterT({}, opfilter::opBuilderHelperIsNull, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsNull, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsNull, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsNull, FAILURE()),
        FilterT({}, opfilter::opBuilderHelperIsNotNull, SUCCESS()),
        FilterT({makeValue(R"("str")")}, opfilter::opBuilderHelperIsNotNull, FAILURE()),
        FilterT({makeRef("ref")}, opfilter::opBuilderHelperIsNotNull, FAILURE()),
        FilterT({makeValue(R"("str")"), makeRef("ref")}, opfilter::opBuilderHelperIsNotNull, FAILURE())),
    testNameFormatter<FilterBuilderTest>("Types"));
} // namespace filterbuildtest

namespace filteroperatestest
{
INSTANTIATE_TEST_SUITE_P(
    Builders,
    FilterOperationTest,
    testing::Values(
        /*** Number ***/
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNumber, "target", {}, SUCCESS()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsNumber, "target", {}, FAILURE()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsNumber, "target", {}, FAILURE()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsNumber, "target", {}, FAILURE()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsNumber, "target", {}, FAILURE()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsNumber, "target", {}, FAILURE()),
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNumber, "notTarget", {}, FAILURE()),
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNotNumber, "target", {}, FAILURE()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsNotNumber, "target", {}, SUCCESS()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsNotNumber, "target", {}, SUCCESS()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsNotNumber, "target", {}, SUCCESS()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsNotNumber, "target", {}, SUCCESS()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsNotNumber, "target", {}, SUCCESS()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsNotNumber, "notTarget", {}, FAILURE()),
        /*** String ***/
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsString, "target", {}, FAILURE()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsString, "target", {}, SUCCESS()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsString, "target", {}, FAILURE()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsString, "target", {}, FAILURE()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsString, "target", {}, FAILURE()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsString, "target", {}, FAILURE()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsString, "notTarget", {}, FAILURE()),
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNotString, "target", {}, SUCCESS()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsNotString, "target", {}, FAILURE()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsNotString, "target", {}, SUCCESS()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsNotString, "target", {}, SUCCESS()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsNotString, "target", {}, SUCCESS()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsNotString, "target", {}, SUCCESS()),
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNotString, "notTarget", {}, FAILURE()),
        /*** Boolean ***/
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsBool, "target", {}, FAILURE()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsBool, "target", {}, FAILURE()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsBool, "target", {}, SUCCESS()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsBool, "target", {}, FAILURE()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsBool, "target", {}, FAILURE()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsBool, "target", {}, FAILURE()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsBool, "notTarget", {}, FAILURE()),
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNotBool, "target", {}, SUCCESS()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsNotBool, "target", {}, SUCCESS()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsNotBool, "target", {}, FAILURE()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsNotBool, "target", {}, SUCCESS()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsNotBool, "target", {}, SUCCESS()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsNotBool, "target", {}, SUCCESS()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsNotBool, "notTarget", {}, FAILURE()),
        /*** Array ***/
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsArray, "target", {}, FAILURE()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsArray, "target", {}, FAILURE()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsArray, "target", {}, FAILURE()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsArray, "target", {}, SUCCESS()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsArray, "target", {}, FAILURE()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsArray, "target", {}, FAILURE()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsArray, "notTarget", {}, FAILURE()),
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNotArray, "target", {}, SUCCESS()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsNotArray, "target", {}, SUCCESS()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsNotArray, "target", {}, SUCCESS()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsNotArray, "target", {}, FAILURE()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsNotArray, "target", {}, SUCCESS()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsNotArray, "target", {}, SUCCESS()),
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNotArray, "notTarget", {}, FAILURE()),
        /*** Object ***/
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsObject, "target", {}, FAILURE()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsObject, "target", {}, FAILURE()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsObject, "target", {}, FAILURE()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsObject, "target", {}, FAILURE()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsObject, "target", {}, SUCCESS()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsObject, "target", {}, FAILURE()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsObject, "notTarget", {}, FAILURE()),
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNotObject, "target", {}, SUCCESS()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsNotObject, "target", {}, SUCCESS()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsNotObject, "target", {}, SUCCESS()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsNotObject, "target", {}, SUCCESS()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsNotObject, "target", {}, FAILURE()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsNotObject, "target", {}, SUCCESS()),
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNotObject, "notTarget", {}, FAILURE()),
        /*** Null ***/
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNull, "target", {}, FAILURE()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsNull, "target", {}, FAILURE()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsNull, "target", {}, FAILURE()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsNull, "target", {}, FAILURE()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsNull, "target", {}, FAILURE()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsNull, "target", {}, SUCCESS()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsNull, "notTarget", {}, FAILURE()),
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNotNull, "target", {}, SUCCESS()),
        FilterT(R"({"target": "str"})", opfilter::opBuilderHelperIsNotNull, "target", {}, SUCCESS()),
        FilterT(R"({"target": true})", opfilter::opBuilderHelperIsNotNull, "target", {}, SUCCESS()),
        FilterT(R"({"target": []})", opfilter::opBuilderHelperIsNotNull, "target", {}, SUCCESS()),
        FilterT(R"({"target": {}})", opfilter::opBuilderHelperIsNotNull, "target", {}, SUCCESS()),
        FilterT(R"({"target": null})", opfilter::opBuilderHelperIsNotNull, "target", {}, FAILURE()),
        FilterT(R"({"target": 1})", opfilter::opBuilderHelperIsNotNull, "notTarget", {}, FAILURE())),
    testNameFormatter<FilterOperationTest>("Types"));
} // namespace filteroperatestest
